<html>
    <head>
        <title>Edit Conference Information</title>
        <link href="style3.css" rel="stylesheet" type="text/css" />

    </head>
    <form name= "form" action = "" value = "Submit" method = "Post">
        <?php

        Function EditInfo($conference_id) {
            $conn = mysql_connect("localhost", "root", ""); //connect to the database

            if (!$conn) {//if no connection was made
                die('Could not connect:' . mysql_error());
            }

            mysql_select_db("mydb", $conn);

            //if submit button was not yet clicked
            if (!isset($_POST['submit'])) {

                echo "<h1>Edit Information</h1>";


                $get_conf_info = mysql_query("SELECT * 
                                    FROM conference 
                                    WHERE conference_id = '$conference_id'") or die(mysql_error());
                while ($row = mysql_fetch_assoc($get_conf_info)) {

                    echo "<table>";

                    echo "<tr>
         <td><b>Long name:</b></td>
         <td><input type =\"text\" name =\"first_name\" value=\"$row[long_name]\"/></td>
         </tr>";

                    echo "<tr>
        <td><b>Short name:</b></td>
        <td><input type =\"text\" name =\"last_name\" value=\"$row[short_name]\"/></td>
        </tr>";

                    echo "<tr>
        <td><b>Description:</b></td>
        <td><input type =\"email\" name =\"email\" rows=\"6\" cols=\"70\" value=\"$row[description]\"/></td>
        </tr>";

                    echo "<tr>
        <td><b>Start Date:</b></td>
        <td><input type =\"text\" name =\"phoneNum\" value=\"$row[rev_startDate]\"/></td>
        </tr>";

                    echo "<tr>
        <td><b>End Date:</b></td>
        <td><input type =\"text\" name =\"fax\" value=\"$row[rev_endDate]\"/></td>
        </tr>";

                    echo "</table>";
                    echo "<br>";
                    echo "<input type =\"submit\" name = \"submit\" value = \"Save\" />";


                    $Longname = $_POST['long_name'];
                    $Shortname = $_POST['short_name'];
                    $Description = $_POST['description'];
                    $StartDate = $_POST['rev_startDate'];
                    $EndDate = $_POST['rev_endDate'];

                    $update_conf_info = mysql_query("UPDATE member
                                                   SET long_name = '$Longname', 
                                                       short_name = '$Shortname', 
                                                       description = '$Description',
                                                       rev_startDate = '$StartDate', 
                                                       rev_endDate = '$EndDate', 
                                                      
                                                    WHERE conference_id = '$conference_id_id'") or die(mysql_error());
                   
                    if ($update_conf_info) {
                        echo "Information Edited Successfully!";
                    } else {

                        echo ("<p>There was an error in executing the query: " .
                        mysql_error() . "</p>");
                    }
                }
            }
        }

        EditInfo(1);

//echo "hi";
        ?>
    </form>
        <label><b>Submission types:</b></label><br/>
        <table border="1">
            <tr>
                <th>  </th>
                <th>  </th>
                <th><b>Paper submission date</b></th>


            </tr>
            <tr>

                <td> <input type="checkbox" name="shortpaper" id="shortpapercheckbox"/></td> <!-- created a checkbox for short paper  and gave it an id in order to use it in the above script -->
                <td> <label for="shortpaper"><b>Short Paper</b></label></td>
                <td> <input type="text" size="9" id="shortpapersubmissiondate"/> Date format yyyy-mm-dd</td>
            </tr>
            <tr>

                <td> <input type="checkbox" name="longpaper" id="longpapercheckbox"/></td> <!-- created a check box for long paper and gave it an id in order to use it in the above script -->
                <td> <label for="longpaper"><b>Long Paper</b></label></td>
                <td> <input type="text" size="9" id="longpapersubmissiondate"/>Date format yyyy-mm-dd</td>
            </tr>
            <!-- this part will be implemented in either sprint 2 or 3 , will be determined later  this is till poster check   -->
            <tr>
                <td> <input type="checkbox" name="Image"/></td>
                <td> <label for="Image"><b>Images</b></label></td>
                <td> <input type="text" size="9"/></td>
            </tr>
            <tr>
                <td> <input type="checkbox" name="Video"/></td>
                <td> <label for="Video"><b>Videos</b></label></td>
                <td> <input type="text" size="9"/></td>
            </tr>
            <tr>
                <td> <input type="checkbox" name="Poster"/></td>
                <td> <label for="Poster"><b>Posters</b></label></td>
                <td> <input type="text" size="9"/></td>
            </tr>
        </table>
  
</html>
